<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-user-add">
			<input name="deptId"  type="hidden" id="treeId"/>
			<div class="form-group">
				<label class="col-sm-3 control-label">供电单位：</label>
				<div class="col-sm-8">
					<input class="form-control"  type="text" name="deptName" onclick="selectDeptTree()" readonly="true" id="treeName">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">电费类别：</label>
				<div class="col-sm-8" th:with="type=${@dict.getType('user_type')}">
					<!--<select id="userType" class="form-control m-b" name="userType"  th:with="type=${@dict.getType('user_type')}">-->
						<!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
					<!--</select>-->

					<label class="check-box" th:each="dict : ${type}">
						<input id="userType" name="userType" th:type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictValue}" />
					</label>

					<!--<label class="check-box"><input name="userType" type="checkbox" value="直购电" />直购电 </label>-->
					<!--<label class="check-box"><input name="userType" type="checkbox" value="自备电厂" />自备电厂 </label>-->
					<!--<label class="check-box"><input name="userType" type="checkbox" value="富余电量" />富余电量 </label>-->
					<!--<label class="check-box"><input name="userType" type="checkbox" value="电能替代" />电能替代 </label>-->

				</div>
			</div>


			<div class="form-group">	
				<label class="col-sm-3 control-label">名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">上网电厂结构：</label>
				<div class="col-sm-8">
					<select id="upStructure" class="form-control m-b" name="upStructure"  th:with="type=${@dict.getType('up_structure')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">电压等级：</label>
				<div class="col-sm-8">
					<select id="voltageGrade" class="form-control m-b" name="voltageGrade"  th:with="type=${@dict.getType('voltage_grade')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用户户号(多个请用英文逗号‘,’隔开)：</label>
				<div class="col-sm-8">
					<input id="userNum" name="userNum" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用电类别：</label>
				<div class="col-sm-8">
					<select id="useEleType" class="form-control m-b" name="useEleType"  th:with="type=${@dict.getType('use_ele_type')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用电替代方案类别：</label>
				<div class="col-sm-8">
					<select id="useEleChangeType" class="form-control m-b" name="useEleChangeType"  th:with="type=${@dict.getType('use_ele_change_type')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">地址：</label>
				<div class="col-sm-8">
					<input id="address" name="address" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "basics/user"
		$("#form-user-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});

		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-user-add').serialize());
	        }
	    }

		/*用户管理-新增-选择部门树*/
        function selectDeptTree() {
            var treeId = $("#treeId").val();
            var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
            var url = ctx + "system/dept/selectDeptTree/" + deptId;
            var options = {
                title: '选择所属供电企业',
                width: "380",
                url: ctx + "system/dept/selectDeptTree/" + deptId,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
        function doSubmit(index, layero){
            var tree = layero.find("iframe")[0].contentWindow.$._tree;
            if ($.tree.notAllowParents(tree)) {
                var body = layer.getChildFrame('body', index);
                $("#treeId").val(body.find('#treeId').val());
                $("#treeName").val(body.find('#treeName').val());
                layer.close(index);
            }
        }
	</script>
</body>
</html>
